package com.firword.common.domain.base;

/**
 * @author: jingyajun
 * @date: 2020/9/29
 * @description:
 * @since:
 */
public class Pager {
    private Integer pageNumber = 1;
    private Integer pageSize = 10;
    private Integer start;
    private Integer end;
    private Integer total;


    public Pager(Integer pageNumber, Integer pageSize) {
        init(pageNumber, pageSize);
    }

    private void init(Integer pageNumber, Integer pageSize) {
        this.pageNumber = pageNumber == null || pageNumber < 1 ? 1 : pageNumber;
        this.pageSize = pageSize == null || pageSize < 5 ? 10 : pageSize;
        this.start = (this.pageNumber - 1) * this.pageSize;
        this.end = this.start + this.pageSize;
    }

    public Integer getStart() {
        return start;
    }

    public Integer getEnd() {
        return end;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getPageNumber() {
        return pageNumber;
    }

    public Integer getPageSize() {
        return pageSize;
    }
}
